<template>
  <v-card>
      <v-flex xs12 sm10>
        <v-tree url="/item/category/list"
                :isEdit="isEdit"
                @handleAdd="handleAdd"
                @handleEdit="handleEdit"
                @handleDelete="handleDelete"
                @handleClick="handleClick"
        />
      </v-flex>
  </v-card>
</template>

<script>
  export default {
    name: "category",
    data() {
      return {
        isEdit:true
      }
    },
    methods: {
      //添加
      handleAdd(node) {
        console.log("add .... ");
        console.log(node);
        console.log("你好")

        this.$http.post("/item/category/add",node).then((resp)=>{
          console.log(resp)
        }).catch()

      },
      handleEdit(id, name) {
        console.log("edit... id: " + id + ", name: " + name)
      },
      //删除
      handleDelete(id) {
        console.log("delete ... " + id)
        this.$http.post("/item/category/del?id="+id).then((data)=>{
        console.log(data)
        }).catch()

      },
      //修改
      handleClick(node) {
        console.log(node)
          this.$http.post("/item/category/update",node).then((data)=>{
            console.log(data);

          }).catch()
      }
    }
  };
</script>

<style scoped>

</style>
